﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WpfChartingControlLibraryTest
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }


        private void AddVerticalBarData()
        {
            myBarChart.DataCollection.DataList.Clear();
            myBarChart.ShowValueLabels = System.Windows.Visibility.Visible;
   //         myBarChart.ValueLabelsMinFontSize = 12;
            myBarChart.ShowValueToolTip = true;
            myBarChart.DataSeriesBar = new ChartingModel.Collections.Series.DataSeriesBar(myBarChart.ChartStyle);

            myBarChart.DataCollection.BarType = ChartingModel.Collections.BarChartDataList.ChartBarType.Vertical;
            myBarChart.ChartStyle.Title = myBarChart.DataCollection.BarType.ToString();
            //            myBarChart.ChartStyle.Xmin = 0;
            //            myBarChart.ChartStyle.Xmax = 5;

            myBarChart.ChartStyle.XTickLabels.Clear();
//            myBarChart.ChartStyle.XTickLabels.Add("Brendan");
//            myBarChart.ChartStyle.XTickLabels.Add("Peter");
//            myBarChart.ChartStyle.XTickLabels.Add("Brendan");
//            myBarChart.ChartStyle.XTickLabels.Add("Peter");
//            myBarChart.ChartStyle.XTickLabels.Add("Brendan");

            myBarChart.ChartStyle.Ymin = 0;
            myBarChart.ChartStyle.Ymax = 8000;
            //            myBarChart.ChartStyle.XTick = 1;
            myBarChart.XAxisTitle = "dddd";
            myBarChart.ChartStyle.YTick = 1;
            myBarChart.ChartStyle.GridLinePattern = ChartingModel.Style.ChartStyleGridLines.ChartGridLinePattern.DashDot;
            myBarChart.ChartStyle.GridLine = ChartingModel.Style.ChartStyleGridLines.ChartGridLine.VerticalHorizontal;
            //            myBarChart.ChartStyle.GridLineColor = Brushes.Black;

            // Draw the bar chart:
            myBarChart.DataSeriesBar.BorderColor = Brushes.Red;
            myBarChart.DataSeriesBar.FillColor = Brushes.Green;
            myBarChart.DataSeriesBar.BarWidth = .8;

            for (int i = 0; i <= 4; i++)
            {
                double x = i + 1.0;
                double y = 500.0 * x;

                myBarChart.DataSeriesBar.AddBar("brendan" + i, y);
//                myBarChart.DataSeriesBar.LineSeries.Points.Add(new Point(x, y));
            }
            myBarChart.DataCollection.DataList.Add(myBarChart.DataSeriesBar);
            myBarChart.AddChart();
        }

        private void AddVerticalGroupBarData()
        {
            myBarChart.DataCollection.DataList.Clear();
            myBarChart.DataCollection.BarType = ChartingModel.Collections.BarChartDataList.ChartBarType.Vertical;
            myBarChart.Title = myBarChart.DataCollection.BarType.ToString();
            myBarChart.ValueLabelsMinFontSize = 8;

            myBarChart.ChartStyle.XTickLabels.Clear();
            myBarChart.ChartStyle.XTickLabels.Add("Brendan");
            myBarChart.ChartStyle.XTickLabels.Add("Peter");
            myBarChart.ChartStyle.XTickLabels.Add("Brendan");
            myBarChart.ChartStyle.XTickLabels.Add("Peter");
            myBarChart.ChartStyle.XTickLabels.Add("Peter");
            myBarChart.ChartStyle.XTickLabels.Add("Peter");

            //            myBarChart.ChartStyle.Xmin = 0;
            //            myBarChart.ChartStyle.Xmax = 5;
            myBarChart.ChartStyle.Ymin = 0;
            myBarChart.ChartStyle.Ymax = 10;
            //        myBarChart.ChartStyle.XTick = 1;
            myBarChart.ChartStyle.YTick = 2;
            myBarChart.ChartStyle.GridLinePattern = ChartingModel.Style.ChartStyleGridLines.ChartGridLinePattern.DashDot;
      //      myBarChart.ChartStyle.GridLineColor = Brushes.Black;

            // Add the first bar series:
            myBarChart.DataSeriesBar = new ChartingModel.Collections.Series.DataSeriesBar(this.myBarChart.ChartStyle);
            myBarChart.DataSeriesBar.BorderColor = Brushes.Red;
            myBarChart.DataSeriesBar.FillColor = Brushes.Green;
            myBarChart.DataSeriesBar.BarWidth = .8;

            for (int i = 0; i < 5; i++)
            {
                double x = i + 1.0;
                double y = 2.0 * x;
                myBarChart.DataSeriesBar.LineSeries.Points.Add(new Point(x, y));
            }
            myBarChart.DataCollection.DataList.Add(myBarChart.DataSeriesBar);

            // Add the second bar series:
            myBarChart.DataSeriesBar = new ChartingModel.Collections.Series.DataSeriesBar(this.myBarChart.ChartStyle);           //new Specialized2DCharts.DataSeriesBar();
            myBarChart.DataSeriesBar.BorderColor = Brushes.Red;
            myBarChart.DataSeriesBar.FillColor = Brushes.DeepPink;
            myBarChart.DataSeriesBar.BarWidth = .8;

            for (int i = 0; i < 5; i++)
            {
                double x = i + 1.0;
                double y = 1.5 * x;
                myBarChart.DataSeriesBar.LineSeries.Points.Add(new Point(x, y));
            }
            myBarChart.DataCollection.DataList.Add(myBarChart.DataSeriesBar);

            // Add the third bar series:
            myBarChart.DataSeriesBar = new ChartingModel.Collections.Series.DataSeriesBar(this.myBarChart.ChartStyle);// Specialized2DCharts.DataSeriesBar();
            myBarChart.DataSeriesBar.BorderColor = Brushes.Red;
            myBarChart.DataSeriesBar.FillColor = Brushes.Blue;
            myBarChart.DataSeriesBar.BarWidth = .8;

            for (int i = 0; i < 5; i++)
            {
                double x = i + 1.0;
                double y = 3.0 * x;
                myBarChart.DataSeriesBar.LineSeries.Points.Add(new Point(x, y));
            }
            myBarChart.DataCollection.DataList.Add(myBarChart.DataSeriesBar);
   //         myBarChart.DataCollection.AddBars(myBarChart.ChartStyle);
            myBarChart.AddChart();
        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            AddVerticalBarData();
        }


        private void AddHorizontalBarChart()
        {
            //myBarChart.DataCollection.DataList.Clear();
            //myBarChart.DataCollection.BarType = ChartingModel.Collections.BarChartDataList.ChartBarType.Horizontal;
            //myBarChart.ChartStyle.Title = myBarChart.DataCollection.BarType.ToString();
            //myBarChart.ChartStyle.Xmin = 0;
            //myBarChart.ChartStyle.Xmax = 10;
            //myBarChart.ChartStyle.Ymin = 0;
            //myBarChart.ChartStyle.Ymax = 5;

            //myBarChart.ChartStyle.YTickLabels.Clear();
            //myBarChart.ChartStyle.YTickLabels.Add("Brendan");
            //myBarChart.ChartStyle.YTickLabels.Add("Peter");
            //myBarChart.ChartStyle.YTickLabels.Add("Bcccrendan"); 
            
            //myBarChart.ChartStyle.XTick = 200;
            //myBarChart.ChartStyle.YTick = 100;
            //myBarChart.ChartStyle.GridLinePattern  = ChartingModel.Style.ChartStyleGridLines.ChartGridLinePattern.DashDot;
            //myBarChart.ChartStyle.GridLineColor = Brushes.Black;


            //// Draw the bar chart:
            //myBarChart.DataSeriesBar = new ChartingModel.Collections.Series.DataSeriesBar();
            //myBarChart.DataSeriesBar.BorderColor = Brushes.Red;
            //myBarChart.DataSeriesBar.FillColor = Brushes.Green;
            //myBarChart.DataSeriesBar.BarWidth = .1;

            //for (int i = 0; i < 5; i++)
            //{
            //    double x = i + 1.0;
            //    double y = 2.0 * x;
            //    myBarChart.DataSeriesBar.LineSeries.Points.Add(new Point(y, x));
            //}
            //myBarChart.DataCollection.DataList.Add(myBarChart.DataSeriesBar);
            //myBarChart.DataCollection.AddBars(myBarChart.ChartStyle);
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            AddVerticalGroupBarData();
        }

    }
}
